package java_class_work.week02;

import java.util.Scanner;

/**
 * 第几天
 */

public class Demo04 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int year, month, day, Noday = 0;
        year = scanner.nextInt();
        month = scanner.nextInt();
        day = scanner.nextInt();
        Noday = getNoday1(year, month, day);
        System.out.println("1这是" + year + "年的第" + Noday + "天！");
        Noday = getNoday2(year, month, day);
        System.out.println("2这是" + year + "年的第" + Noday + "天！");
    }

    public static int getNoday1(int year, int month, int day) {
        int noday = 0;
        switch (month - 1) {
            case 11:
                noday += 30;
            case 10:
                noday += 31;
            case 9:
                noday += 30;
            case 8:
                noday += 31;
            case 7:
                noday += 31;
            case 6:
                noday += 30;
            case 5:
                noday += 31;
            case 4:
                noday += 30;
            case 3:
                noday += 31;
            case 2:
                noday += isYear(year) ? 29 : 28;
            case 1:
                noday += 31;
            case 0:
                noday += day;
        }
        return noday;
    }

    static int getNoday2(int year, int month, int day) {
        int Noday = 0;
        int[] day_ = {day, 31, isYear(year) ? 29 : 28, 31, 30, 31, 30, 31, 31, 30, 31, 30};
        for (int i = 0; i < month; i++) {
            Noday += day_[i];
        }
        return Noday;
    }

    static boolean isYear(int year) {
        if (year % 400 == 0)
            return true;
        if (year % 4 == 0 && year % 100 != 0)
            return true;
        return false;
    }
}
